package gtkwire.widget;

import gtkwire.*;
import gtkwire.widget.utils.PangoEllipsizeMode;

/**
*A widget that displays a small to medium amount of text.
*/
public class GtkLabel extends GtkMisc
{
	public GtkLabel()
	{
		super();
		widgetType = WT_GtkLabel;
		gtkCreate();
	}

	/**
	*Creates new named GTK+ widget handle. Name must be unique. If the handle is used to control/identify GTK+ widget created in glade, 
	*it must have the name specified in glade.
	*/
	public GtkLabel( String name, GladeKey key )
	{
		super( name, key );
		widgetType = WT_GtkLabel;
	}
	
	/**
	*Sets the text within the GtkLabel widget. It overwrites any text that was there before.
	*/
	public void setText( String text )
	{
		app().sendCommand( name, GTKWireCommand.SET_LABEL, text );
	}

	/**
	* Parses str which is marked up with the Pango text markup language, setting the label's text and attribute list based on the parse results.
	*/
	public void setMarkUp( String text )
	{
		app().sendCommand( name, GTKWireCommand.SET_MARKUP, text );
	}

	/**
	*Toggles line wrapping within the GtkLabel widget. TRUE makes it break lines if text exceeds the widget's size. 
	*FALSE lets the text get cut off by the edge of the widget if it exceeds the widget size.
	*
	*Note that setting line wrapping to TRUE does not make the label wrap at its parent container's width,
	* because GTK+ widgets conceptually can't make their requisition depend on the parent container's size.
	*/
	public void setLineWrap( boolean b )
	{
		app().sendCommand( name, GTKWireCommand.SET_WRAP, b );
	}

	/**
	*Sets the mode used to ellipsize (add an ellipsis: "...") to the text if there is not enough space to render the entire string.
	*/
	public void setEllipsize( PangoEllipsizeMode mode )
	{
		app().sendCommand( name, GTKWireCommand.SET_ELLIPSIZE, mode.getMode() );
	}

	/**
	*Sets the angle of rotation for the label. An angle of 90 reads from from bottom to top, 
	*an angle of 270, from top to bottom. The angle setting for the label is ignored if the label is selectable, wrapped, or ellipsized.
	*/
	public void setAngle( double angle )
	{
		app().sendCommand( name, GTKWireCommand.SET_ANGLE, angle );
	}

	/**
	*Sets the desired width in characters
	*/
	public void setWidthInChars( int width )
	{
		app().sendCommand( name, GTKWireCommand.SET_WIDTH, width );
	}

}//end class